<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>大鹅视频</title>

		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
		<meta http-equiv="Cache-Control" content="no-siteapp"/>
		<!-- 防止ios缓存html文件 -->
		<meta http-equiv="Pragma" content="no-cache">
		<meta http-equiv="Cache-Control" content="no-cache">
		<meta http-equiv="Expires" content="0">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=yes, viewport-fit=contain">
		<!-- 删除苹果默认的菜单栏 -->
		<meta name="apple-mobile-web-app-capable" content="yes"/>
		<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
		<link rel="shortcut icon" href="./static/icon.png">
		<script>
				// 移动端dpr适配,最好放head里面，放在body后面会导致比较严重的网页重绘
				(function (){
					var dpr,
						rem,
						scale,
						viewport_content,
						is_allow=false,
						docEl  = document.documentElement,
						metaEl = document.querySelector('meta[name="viewport"]'),
						allow_dpr = [1, 1.5, 2, 2.5, 2.75, 3, 3.5, 4];
					dpr = window.devicePixelRatio || 1;
					dpr = 1;

					for (var i = allow_dpr.length; i >= 0; i--) {
						if(dpr == allow_dpr[i]){
							is_allow = true;
						}
					}
					if (!is_allow) { dpr = 1; }
					scale = 1 / dpr;

					var isMobile =  /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile/i.test(navigator.userAgent);
					// 获取url参数
					const getQueryPara = function (paraName, dft = null) {
						var sUrl = location.href;
						sUrl = sUrl.replace("#/index", "");
						var sReg = '[\?&]{1}' + paraName + '=([^&]*)';
						var re = new RegExp(sReg);
						var rst = (sUrl.match(re));
						if (rst === null) return dft;
						return decodeURIComponent(rst[1]);
					};
					if(!isMobile) {
						location.href = 'https://gateway.ailive.cloud/pc/#/home?id=' + getQueryPara("id");
						// location.href = 'https://test.ailive.cloud/pc/#/home?id=' + getQueryPara("id");
					}

					/***** 10rem = 100% *****/
					var shortSide = window.screen.height > window.screen.width ? window.screen.width : window.screen.height;
					rem   = (shortSide>500 && !isMobile ? 500 : shortSide) * dpr / 10;

					// 设置viewport，进行缩放，达到高清效果
					viewport_content = 'width=' + dpr * docEl.clientWidth
						+ ',initial-scale=' + scale
						+ ',maximum-scale=' + scale
						+ ', minimum-scale=' + scale
						+ ',user-scalable=no, viewport-fit=contain';
					metaEl.setAttribute('content', viewport_content);

					function setRem(rem, dpr){
						// 设置data-dpr属性，留作的css hack之用
						docEl.setAttribute('data-dpr', dpr);

						docEl.style.fontSize = rem + 'px';

						// 给js调用的，某一dpr下rem和px之间的转换函数
						window.rem2px = function(v){
							return parseFloat(v) * rem;
						};
						window.px2rem = function(v){
							return parseFloat(v) / rem;
						};
						// 设计稿像素转换实际像素
						window.px2px = function(v){
							return v * rem / 75;
						};
						window.dpr = dpr;
						window.rem = rem;
					}
					setRem(rem, dpr);

					window.document.addEventListener('DOMContentLoaded', function(){
						var div = document.createElement('div');
						div.style.width = '1rem';
						div.style.height = '0';
						document.body.appendChild(div);
						var ratio = rem / div.clientWidth;
						if(Math.abs(ratio - 1) > 0.05){
							setRem(rem * ratio, dpr);
						}
						document.body.removeChild(div);

						console.log('检测rem是否正确:', ratio);
					});

					var _hmt = _hmt || [];
					(function() {
						var hm = document.createElement("script");
						hm.src = "https://hm.baidu.com/hm.js?e1ad43073f4778a9a682d4b9306c5f3a";
						var s = document.getElementsByTagName("script")[0]; 
						s.parentNode.insertBefore(hm, s);
					})();
					
				})();
			</script>
		
		<link rel="stylesheet" href="https://g.alicdn.com/de/prismplayer/2.8.2/skins/default/aliplayer-min.css"/>
	</head>
	<body>
		<div id="app"></div>
		
		<!-- built files will be auto injected -->
		<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>	
		<script src="https://gosspublic.alicdn.com/aliyun-oss-sdk-6.1.1.min.js"></script>
		<script type="text/javascript" charset="utf-8" src="https://g.alicdn.com/de/prismplayer/2.8.2/aliplayer-h5-min.js"></script>
		<script src="./static/jmessage-sdk-web.2.6.0.min.js"></script>
	</body>
</html>
